<!DOCTYPE html>
<html lang="en">
	<head>
		<meta charset="UTF-8" />
		<meta name="viewport" content="width=device-width, initial-scale=1.0" />
		<title>box-sizing</title>
		<style>
			.box1 {
				width: 200px;
				height: 200px;
				background-color: red;
				border: 4px solid black;
				padding: 10px;
				/* content-box：设置元素的宽度和高度只包含内容，不包含内边距和边框。 */
				box-sizing: content-box;
			}

			.box2 {
				width: 200px;
				height: 200px;
				background-color: blue;
				border: 4px solid black;
				padding: 10px;
				/* border-box：设置元素的宽度和高度包含内边距和边框，即使设置了padding和border。 */
				box-sizing: border-box;
			}
		</style>
	</head>
	<body>
		<div class="box1">content-box</div>

		<hr />

		<div class="box2">border-box</div>
	</body>
</html>
